package com.tanhua.dubbo.server.api;

import cn.hutool.core.date.DateTime;
import com.tanhua.dubbo.server.pojo.Comment;
import com.tanhua.dubbo.server.pojo.Publish;
import com.tanhua.dubbo.server.vo.PageInfo;

import java.util.List;

/**
 * @Author: JinboYang
 * @Description:
 * @Date: Created in 下午 20:22 2021/1/5
 * @ModifiedBy:
 */
public interface QuanZiApi {
    /**
     * 发布动态
     *
     * @param publish
     * @return
     */
    String savePublish(Publish publish);

    /**
     * @Description: 查询动态
     * @Param:[userId, page, pageSize]
     * @return:com.tanhua.dubbo.server.vo.PageInfo<com.tanhua.dubbo.server.pojo.Publish>
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    PageInfo<Publish> queryPublishList(Long userId, Integer page, Integer pageSize);

    /**
     * @Description: 点赞
     * @Param:[userId, publishId]
     * @return:boolean
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    boolean saveLikeComment(Long userId, String publishId);

    /**
     * @Description: 取消喜欢点赞
     * @Param:[userId, publishId, commentType]
     * @return:boolean
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    boolean removeComment(Long userId, String publishId, Integer commentType);

    /**
     * @Description: 喜欢
     * @Param:[userId, publishId]
     * @return:boolean
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    boolean saveLoveComment(Long userId, String publishId);

    /**
     * @Description: 保存评论
     * @Param:[userId, publishId, type, content]
     * @return:boolean
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    boolean saveComment(Long userId, String publishId, Integer type, String content);

    /**
     * @Description: 查看评论数
     * @Param:[publishId, type]
     * @return:java.lang.Long
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    Long queryCommentCount(String publishId, Integer type);

    /**
     * @Description: 根据id查询动态
     * @Param:[id]
     * @return:com.tanhua.dubbo.server.pojo.Publish
     * @Author:JinboYang
     * @Date:2021/1/7
     */
    Publish queryPublishById(String id);

    /**
     * @Description: 查看评论
     * @Param:[publishId, page, pageSize]
     * @return:com.tanhua.dubbo.server.vo.PageInfo<com.tanhua.dubbo.server.pojo.Comment>
     * @Author:JinboYang
     * @Date:2021/1/8
     */
    PageInfo<Comment> queryCommentList(String publishId, Integer page, Integer pageSize);


    /**
     * @Description: 查询用户的评论数据
     * @Param:[userId, type, page, pageSize]
     * @return:com.tanhua.dubbo.server.vo.PageInfo<com.tanhua.dubbo.server.pojo.Comment>
     * @Author:JinboYang
     * @Date:2021/1/10
     */
    PageInfo<Comment> queryCommentListByUser(Long userId, Integer type, Integer page, Integer pageSize);


    List<Publish> queryPublishByPids(List<Long> pidList);

    /**
     * @Description: 查询相册表
     * @Param:[userId, page, pageSize]
     * @return:com.tanhua.dubbo.server.vo.PageInfo<com.tanhua.dubbo.server.pojo.Publish>
     * @Author:JinboYang
     * @Date:2021/1/13
     */
    PageInfo<Publish> queryAlbumList(Long userId, Integer page, Integer pageSize);


    /**
     * @Description: 查询活跃数
     * @Param:[thisYearTimeList, lastYearTimeList]
     * @return:java.util.List<java.lang.Integer>
     * @Author:JinboYang
     * @Date:2021/1/18
     */
    List<Integer> queryCommentCounts(List<Long> thisYearTimeList, List<Long> lastYearTimeList);

    /**
     * @Description: 查询次日留存率
     * @Param:[nextList, thisYearTimeList, lastYearTimeList]
     * @return:java.util.List<java.lang.Integer>
     * @Author:JinboYang
     * @Date:2021/1/18
     */
    List<Integer> queryNextDay(List<List<Long>> nextList, List<Long> thisYearTimeList, List<Long> lastYearTimeList);


    /**
     * @Description: 查询过去30天活跃数
     * @Param:[oldDate, nowTime]
     * @return:java.lang.Integer
     * @Author:JinboYang
     * @Date:2021/1/18
     */
    Integer queryActivePassMonth(DateTime oldDate, DateTime nowTime);

    /**
     * @Description: 根据时间查询登录人数
     * @Param:[zeroTime, nowTime]
     * @return:java.lang.Integer
     * @Author:JinboYang
     * @Date:2021/1/18
     */
    Integer queryLoginCountByTime(DateTime zeroTime, DateTime nowTime);

    /**
     * @Description: 根据时间查询活跃人数
     * @Param:[zeroTime, nowTime]
     * @return:java.lang.Integer
     * @Author:JinboYang
     * @Date:2021/1/18
     */
    Integer queryActiveUserByTime(DateTime zeroTime, DateTime nowTime);


    Integer queryActiveSevenDays(DateTime sevenDate, DateTime zeroTime);


    List<Integer> queryLoginCount(List<List<Long>> createdIdList, List<Long> thisYearTimeList, List<Long> lastYearTimeList);
}
